﻿using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls;
using FxWinSuper.Annotations;

namespace WinSupperUpdateService.UI
{
	/// <summary>
	/// UpdateNotify.xaml 的交互逻辑
	/// </summary>
	public partial class UpdateNotify : UserControl, INotifyPropertyChanged
	{
		public UpdateNotify()
		{
			InitializeComponent();
		}

		public event PropertyChangedEventHandler PropertyChanged;

		[NotifyPropertyChangedInvocator]
		protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
		{
			PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
		}

		private string _title = string.Empty;

		public string Title
		{
			get => _title;
			set
			{
				_title = value;
				OnPropertyChanged();
			}
		}

		private string _msg = string.Empty;

		public string Msg
		{
			get => _msg;
			set
			{
				_msg = value;
				OnPropertyChanged();
			}
		}

		public event Action OnConfirm;

		public event Action OnCancel;

		private void Button_Click(object sender, RoutedEventArgs e)
		{
			OnConfirm?.Invoke();
		}

		private void Button_Click_1(object sender, RoutedEventArgs e)
		{
			OnCancel?.Invoke();
		}
	}
}
